<template>
  <view>
    <u-card
      :show-head="false"
      v-for="item in planPayInfo"
      :key="item.paymentPlanId"
    >
      <view slot="body">
        <view class="u-main-color">{{ item.paymentRuleDesc }}</view>
        <view class="u-tips-color u-m-t-10"
          >计划付款日期：{{ item.payPlanDateShow }}</view
        >
      </view>
      <view slot="foot">
        <view class="u-p-30 u-flex u-row-between">
          <view class="u-main-color">计划付款金额(元)：</view>
          <view class="u-f-w-b u-main-color">{{
            item.payAmount ? formatPrice(item.payAmount) : '-'
          }}</view>
        </view>
      </view>
    </u-card>
    <view style="padding-top: 40vh" v-if="planPayInfo.length === 0"
      ><u-empty text="暂无数据" mode="list"></u-empty
    ></view>
  </view>
</template>
<script lang="ts" setup>
import { getPaymentPlanList } from '@/api/modules/finance';
import { formatPrice } from '@/utils/tools';
const props = defineProps<{
  contractId: any;
}>();

const { contractId } = toRefs(props);
const planPayInfo = ref<any>([]);
const getplanPayInfo = async () => {
  let res: any = await getPaymentPlanList({
    contractId: contractId.value,
  });
  planPayInfo.value = res || [];
};
getplanPayInfo();
</script>
